package Top200;

/**
 * @author zhangmin
 * @create 2022-02-17 13:36
 * 从低位到高位按位反转
 */
public class reverse07 {
    public int reverse(int x) {
        int res=0;
        while (x!=0){
            int t=res*10+x%10;
            if ((t-x%10)/10!=res){
                return 0;
            }
            res=t;
            x=x/10;
        }
        return res;
    }
}
